package com.power.using.mybomb.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.power.using.mybomb.R;

import java.text.SimpleDateFormat;

import butterknife.BindView;
import cn.bmob.newim.bean.BmobIMMessage;

/**
 * Created by 聪明一只哈 on 2020/3/24.
 * Time: 2020/3/24  13:46
 */
public class AgreeHolder extends BaseViewHolder implements View.OnClickListener, View.OnLongClickListener {


    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.tv_message)
    TextView tvMessage;

    public AgreeHolder(Context context, ViewGroup root, OnRecyclerViewListener listener) {
        super(context, root, R.layout.item_chat_agree, listener);
    }

    @Override
    public void bindData(Object o) {
        BmobIMMessage message= (BmobIMMessage) o;
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        String time = dateFormat.format(message.getCreateTime());
        String content = message.getContent();
        tvMessage.setText(content);
        tvTime.setText(time);
    }

    public void showTime(boolean isShow){
        tvTime.setVisibility(isShow?View.VISIBLE:View.INVISIBLE);
    }
}
